package com.taxshare.seller.service;

import java.text.DecimalFormat;

import com.taxshare.tools.util.UUIDUitl;
import lombok.extern.slf4j.Slf4j;

import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.taxshare.seller.entity.InvoiceLogEntity;
import com.taxshare.seller.mapper.InvoiceLogMapper;

@Service
@Slf4j
public class InvoiceLogService extends ServiceImpl<InvoiceLogMapper, InvoiceLogEntity> {

    @Async
    public void insertInterfaceLog(String method, String reqContent, String respContent, int time) {
        DecimalFormat df = new DecimalFormat("#0.00");
        InvoiceLogEntity entity = new InvoiceLogEntity();
        entity.setUuid(UUIDUitl.UUID32());
        entity.setMethod(method);
        entity.setReqContent(reqContent);
        entity.setRespContent(respContent);
        entity.setTime(df.format((double) time / 1000));
        baseMapper.insert(entity);
    }
}
